package cn.com.bsoft.mobile.dao

import cn.com.bsoft.mobile.entity.AppMessage
import cn.com.bsoft.mobile.entity.AppMessageJob
import cn.net.xyan.blossom.core.support.EasyJpaRepository
import org.springframework.data.jpa.repository.Query
import java.util.*

interface AppMessageDao: EasyJpaRepository<AppMessage, String> {

}

interface AppMessageJobDao:EasyJpaRepository<AppMessageJob,String>{
    @Query("select job from AppMessageJob job join job.device d " +
            " where job.sentDate is null and d.type = ?1 and job.createDate > ?2 and job.nextSendDate <= ?3")
    fun queryUnSent(type:String,notBefore: Date,sendTime:Date = Date()):List<AppMessageJob>
}